#ifndef __DETU_VI_CHN_IMP_H__
#define __DETU_VI_CHN_IMP_H__

#include "vi_chn.h"
#include "mutex.h"

#include "hi_common.h"
#include "hi_comm_vi.h"

namespace detu_media
{

class ViPipeImp;

class ViChnImp: public ViChn
{

protected:
	ViChnImp(const VI_PIPE pipeId);

	~ViChnImp();

	friend class ViPipeImp;
	
public:
	virtual S_Result start(void);
	
	virtual S_Result stop(void);
	
	virtual bool isStarted(void);

	virtual S_Result getId(int& id);

private:
	S_Result init(const Json::Value& config);
	
	S_Result deInit(void);
	
	bool isInited(void);

private:
	
	constexpr static const VI_CHN_ATTR_S defaultChnAttr = 
	{
	    .stSize = 
		{
			.u32Width = 3968,
			.u32Height = 2768
		},
	    .enPixelFormat = PIXEL_FORMAT_YVU_SEMIPLANAR_420,
	    .enDynamicRange = DYNAMIC_RANGE_SDR8,
	    .enVideoFormat = VIDEO_FORMAT_LINEAR,
	    .enCompressMode = COMPRESS_MODE_NONE,//COMPRESS_MODE_SEG,
	    .bMirror = HI_FALSE,
	    .bFlip = HI_FALSE,
	    .u32Depth = 0,
	    .stFrameRate = 
		{
			.s32SrcFrameRate = -1,
			.s32DstFrameRate = -1
		}
	};

private:
	bool fInited;
	int fRef;
	VI_PIPE fPipeId;
	VI_CHN fChnId;
	VI_CHN_ATTR_S fChnAttr;

	detu_infra::Mutex fMutex;
	
};


}

#endif

